#
# Grammar Class
#

require 'soul/core'

module Soul

class Grammar

	include Soul
	
	def initialize(scanner = Soul::Scanner)
		@scanner_class = scanner
	end

	def parse(what)
		@scanner = @scanner_class.new(what)
		self.start
	end

	def next
		@scanner.next
	end
	
	def match(input)
		(@la == input) ? @la = self.next : self.error
	end

	def error
		puts "Error Parsing @ #{@i}"
	end

end

end # Module
